<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Origami::XRefStream</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Origami::XRefStream</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/origami/xreftable_rb.html">
                origami/xreftable.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Stream.html">
                Stream
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Class representing a <a href="XRef.html">XRef</a> <a
href="Stream.html">Stream</a>.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000589">&lt;&lt;</a>&nbsp;&nbsp;
      <a href="#M000592">clear</a>&nbsp;&nbsp;
      <a href="#M000590">each</a>&nbsp;&nbsp;
      <a href="#M000591">find</a>&nbsp;&nbsp;
      <a href="#M000588">new</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name">Enumerable</span>
        <span class="include-name"><a href="Configurable.html">Configurable</a></span>
      </div>
    </div>

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">XREF_FREE</td>
          <td>=</td>
          <td class="context-item-value">0</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">XREF_USED</td>
          <td>=</td>
          <td class="context-item-value">1</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">XREF_COMPRESSED</td>
          <td>=</td>
          <td class="context-item-value">2</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">W</td>
          <td>=</td>
          <td class="context-item-value">[ 1, 2, 2 ] unless has_field?(:W)</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">Size</td>
          <td>=</td>
          <td class="context-item-value">@xrefs.length + 1</td>
        </tr>
        </table>
      </div>
    </div>



    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">xrefs</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000588" class="method-detail">
        <a name="M000588"></a>

        <div class="method-heading">
          <a href="#M000588" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(data = &quot;&quot;, dictionary = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000588-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000588-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xreftable.rb, line 337</span>
337:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">data</span> = <span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">dictionary</span> = {})
338:       <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">dictionary</span>)
339: 
340:       <span class="ruby-ivar">@xrefs</span> = <span class="ruby-keyword kw">nil</span>
341:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000589" class="method-detail">
        <a name="M000589"></a>

        <div class="method-heading">
          <a href="#M000589" class="method-signature">
          <span class="method-name">&lt;&lt;</span><span class="method-args">(xref)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Adds an <a href="XRef.html">XRef</a> to this <a
href="Stream.html">Stream</a>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000589-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000589-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xreftable.rb, line 357</span>
357:     <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-identifier">xref</span>)
358:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@xrefs</span>.<span class="ruby-identifier">nil?</span>
359: 
360:       <span class="ruby-ivar">@xrefs</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">xref</span>  
361:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000592" class="method-detail">
        <a name="M000592"></a>

        <div class="method-heading">
          <a href="#M000592" class="method-signature">
          <span class="method-name">clear</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000592-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000592-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xreftable.rb, line 392</span>
392:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
393:       <span class="ruby-ivar">@rawdata</span> = <span class="ruby-value str">&quot;&quot;</span>
394:       <span class="ruby-ivar">@xrefs</span> = []
395:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000590" class="method-detail">
        <a name="M000590"></a>

        <div class="method-heading">
          <a href="#M000590" class="method-signature">
          <span class="method-name">each</span><span class="method-args">(&amp;b)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Iterates over <a href="XRefStream.html#M000590">each</a> <a
href="XRef.html">XRef</a> present in the stream.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000590-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000590-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xreftable.rb, line 366</span>
366:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)
367:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@xrefs</span>.<span class="ruby-identifier">nil?</span>
368: 
369:       <span class="ruby-ivar">@xrefs</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>)
370:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000591" class="method-detail">
        <a name="M000591"></a>

        <div class="method-heading">
          <a href="#M000591" class="method-signature">
          <span class="method-name">find</span><span class="method-args">(no)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns an <a href="XRef.html">XRef</a> matching this object number.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000591-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000591-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xreftable.rb, line 375</span>
375:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">no</span>)
376:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@xrefs</span>.<span class="ruby-identifier">nil?</span>
377: 
378:       <span class="ruby-identifier">ranges</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-constant">Index</span> <span class="ruby-operator">||</span> [ <span class="ruby-value">0</span>, <span class="ruby-ivar">@xrefs</span>.<span class="ruby-identifier">length</span> ]
379: 
380:       <span class="ruby-identifier">index</span> = <span class="ruby-value">0</span>
381:       (<span class="ruby-identifier">ranges</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span>).<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
382:         <span class="ruby-identifier">brange</span> = <span class="ruby-identifier">ranges</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">*</span><span class="ruby-value">2</span>].<span class="ruby-identifier">to_i</span>
383:         <span class="ruby-identifier">size</span> = <span class="ruby-identifier">ranges</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">*</span><span class="ruby-value">2</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>].<span class="ruby-identifier">to_i</span>
384:         <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@xrefs</span>[<span class="ruby-identifier">index</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">no</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">brange</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Range</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">brange</span>, <span class="ruby-identifier">brange</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">size</span>) <span class="ruby-operator">===</span> <span class="ruby-identifier">no</span>
385: 
386:         <span class="ruby-identifier">index</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">size</span>
387:       <span class="ruby-keyword kw">end</span>
388: 
389:       <span class="ruby-keyword kw">nil</span>
390:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>